import request from '@/utils/request'

/**
 * 获取用户基本信息
 * @returns Params
 */
export const getUserInfoAPI = () => {
  return request({
    url: '/my/userinfo'
  })
}

/**
 * 修改用户基本信息
 * @param {Object} userForm 用户详情对象
 * @returns code+返回信息
 */
export const setUserInfoApi = (userForm) => {
  return request({
    method: 'put',
    url: '/my/userinfo',
    data: userForm
  })
}

/**
 * 修改密码
 * @param {Object} userForm 用户表单
 * @returns code+提示信息
 */
export const resetUserPwdAPI = (userForm) => {
  return request({
    url: '/my/updatepwd',
    data: userForm,
    method: 'PATCH'
  })
}

/**
 * 修改用户头像
 * @param {String} imgUrl 头像地址
 * @returns code+提示信息
 */
export const setUserImageAPI = (imgUrl) => {
  return request({
    url: '/my/update/avatar',
    method: 'PATCH',
    data: imgUrl
  })
}
